//
//  HMMonthCell.m
//  HeartMark
//
//  Created by rimi on 2016/11/8.
//  Copyright © 2016年 黄华强. All rights reserved.
//

#import "HMMonthCell.h"

@interface HMMonthCell ()

@property (nonatomic,strong) UILabel *leftLabel;
@property (nonatomic,strong) UILabel *rightLabel;
@property (nonatomic,strong) UIImageView *rightImageV;

@end

@implementation HMMonthCell

- (void)awakeFromNib {
    [super awakeFromNib];

}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self setupUI];
    }
    return self;
}

-(void)setModel:(MonthsModel *)model {
    _model = model;
    _leftLabel.text = _model.month;
   
    _leftLabel.textColor = [[UIColor alloc] initWithRed:0.8 green:0.9 blue:0.3 alpha:1];
       
    NSInteger count = [_model.noteModels count];
    if (_model.isDelop) {
        [_rightLabel setHidden:YES];
        [_rightImageV setHidden:NO];
        _rightImageV.image = [UIImage imageNamed:@"向上"];
    } else {
        [_rightImageV setHidden:YES];
        [_rightLabel setHidden:NO];
        _rightLabel.text = [NSString stringWithFormat:@"有%ld条笔记",(long)count];
    }
    
    
}

- (void)setupUI {
    _rightImageV = [[UIImageView alloc] initWithFrame:CGRectMake(SCREEN_WIDTH - 36, 12, 20, 20)];
    [self.contentView addSubview:_rightImageV];
    
    
    _leftLabel = [[UILabel alloc] initWithFrame:CGRectMake(12, 0, SCREEN_WIDTH * 0.3, 44)];
    _leftLabel.font = [UIFont systemFontOfSize:15];
    
    [self.contentView addSubview:_leftLabel];
    
    _rightLabel = [[UILabel alloc] initWithFrame:CGRectMake(SCREEN_WIDTH * 0.7 - 12, 0, SCREEN_WIDTH * 0.3, 44)];
    _rightLabel.textAlignment = NSTextAlignmentRight;
    _rightLabel.font = [UIFont systemFontOfSize:11];
    [self.contentView addSubview:_rightLabel];
    
}

@end
